<?php

class Page extends Controller {
	
	public function index(){
		$this->title = $this->CFG["naslov"];
		$announced = (int)$_SESSION["announced"];
		$a = Admin::getAnnounce();
		
		if($a && !$announced){
			$_SESSION["announced"] = 1;
			$this->set("announce", $a);
			echo $this->fetch("announce");
			die;
		}
		$this->render("page/index");
	}

	public function show($page="index"){
		if($page=="index"){
			$this->index();
			return;
		}
	
		$text_file = "resource/locale/$page.txt";
		$txt = "";
		
		$labels = $menu = parse_ini_file("lib/menu.ini");
		$title = $labels[$page]; $title = $title ? $title : $this->CFG["naslov"];
		$this->title = mb_strtoupper(mb_substr($title, 0, 1, "UTF-8"), "UTF-8") . mb_strtolower(mb_substr($title, 1, 200, "UTF-8"), "UTF-8");
		
		if(file_exists($text_file)){
			$txt = parse_ini_file($text_file);
		}
		$this->set("TXT", $txt);
		$this->set("page", $page);
		$this->render("page/$page");
	}
}

?>